<%@ page language="java" pageEncoding="utf-8"%>
<%@taglib uri="/WEB-INF/page-base.tld" prefix="p"%>
<script>

function userrank_changeuser(uid,obj){
	var str=ctx+"/platform/user/UserManagePage.page?actions=setRankShow&bean.userid="+uid+"&deptId="+obj.value;
	$w.reloadCurrWin(str);
}
function userrank_serach(){
	var str=ctx+"/platform/user/UserManagePage.page?actions=searchRank&rankName="+$getByName("rankName",$w.currWinForm()).val();
	$w.doUrl(str,{},function(json){
		var list=json.data;
		var ursle=document.getElementById('urselect1');
		comboxOperator.clearOption(ursle);
		$(list).each(function(){
			comboxOperator.addOption(ursle,this.rankid,this.rankname);
		});
	});
}
function useradmin_setrank(){
	comboxOperator.selectAll($getByName('userRankIds',$w.currWinForm())[0]);
	comboxOperator.selectAll($getByName('postIds',$w.currWinForm())[0]);
	$w.doWinForm()
}
</script>

<div class="easyui-panel" data-options="doSize:false,layoutH:43,border:false" style="margin-top:5px;margin-left:5px ">
	<form method="post" action="/platform/user/UserManagePage.page">
		<p:hidden bind="bean.userid"/>
  		<p:hidden bind="actions"/>
  		<div class="ui-formContent" layoutH="56">
  			<p style="float:left;">
				<label style="width:70px;text-align:right">账&nbsp;&nbsp;号：</label>
				<p:text bind="bean.loginname" readonly="readonly" style="width:135px"/>
			</p>
			<p style="float:right;padding-right:40px">
				<label style="width:70px;text-align:right">用户名：</label>
				<p:text bind="bean.username" readonly="readonly" style="width:135px"/>
			</p>
			<div style="width:100%;clear:both">
				<label style="width:70px;text-align:right">所属部门：</label>
				 <select name="deptId" onchange="userrank_changeuser('<p:write bind="bean.userid"/>',this)" style="width:375px;"><p:options bind="deptId" collection="deptList" value="deptid" text="deptname"/></select>
			</div>
			<div class="easyui-tabs" style="width:470px;margin-top:14px;" >
				<div title="菜单权限">
					<table width="100%" cellpadding="0" cellspacing="0">
					<tr><td height="4"></td></tr>
				  	<tr>
					  <td align="center"  valign="top">
						  <div class="easyui-panel" title="可选权限" style="width:195px">
							<div style="background:#ffffff;margin:0px;padding:0px">
								<div>
								<input name="rankName" class="easyui-searchbox" style="width:192px;" data-options="searcher:function(value,name){userrank_serach()}"></input>
								</div>
								<select style="width:100%;height:210px;" multiple="true" name="urselect1" id="urselect1">
					  			<p:options bind="" collection="rankList" value="rankid" text="rankname"/>
					  			</select>
							</div>
						</div>
					  </td>
					  <td>
					  	<div style="width:100%;text-align:center">
					  	<button style="width:40px" title="移动选择项" onclick="comboxOperator.moveOption(document.getElementById('urselect1'),document.getElementById('userRankIds'));return false;">&gt;</button><br/>
						<button style="width:40px;margin-top:6px;" title="移动所有项" onclick="comboxOperator.moveAllOption(document.getElementById('urselect1'),document.getElementById('userRankIds'));return false;">&gt;&gt;</button><br/>
						<button style="width:40px;margin-top:6px;" title="移动选择项" onclick="comboxOperator.moveOption(document.getElementById('userRankIds'),document.getElementById('urselect1'));return false;">&lt;</button><br/>
						<button style="width:40px;margin-top:6px;" title="移动所有项" onclick="comboxOperator.moveAllOption(document.getElementById('userRankIds'),document.getElementById('urselect1'));return false;">&lt;&lt;</button>
						</div>
					  </td>
					  <td align="center" valign="top">
					   <div class="easyui-panel" title="已选权限" style="width:195px">
							<div style="background:#ffffff;margin:0px;padding:0px">
								<select style="width:100%;height:225px;" multiple="true" id="userRankIds" name="userRankIds">
								  <p:options bind="" collection="selRankList" value="rankid" text="rankname"/>
								  </select>
							</div>
						</div>
					  </td>
			  		</tr>
				  </table>
				</div>
				<div title="岗 位">
					<table cellpadding="0" cellspacing="0" width="100%">
						<tr>
						<td width="43%" style="padding-top:3px;">
							<select name="postListsel" multiple="multiple" style="width:98%;height:265px;"><p:options bind="" collection="postList" value="id" text="name"/></select>
						</td>
						<td width="14%">
						<div style="margin-left:15px;margin-top:3px;">
							<button style="width:40px" title="移动选择项" onclick="comboxOperator.moveOption(document.all.postListsel,document.all.postIds);return false;">&gt;</button><br/>
							<button style="width:40px;margin-top:6px;" title="移动所有项" onclick="comboxOperator.moveAllOption(document.all.postListsel,document.all.postIds);return false;">&gt;&gt;</button><br/>
							<button style="width:40px;margin-top:6px;" title="移动选择项" onclick="comboxOperator.moveOption(document.all.postIds,document.all.postListsel);return false;">&lt;</button><br/>
							<button style="width:40px;margin-top:6px;" title="移动所有项" onclick="comboxOperator.moveAllOption(document.all.postIds,document.all.postListsel);return false;">&lt;&lt;</button>
						 </div>	
						</td>
						<td width="43%">
						<select name="postIds" multiple="multiple" style="width:98%;height:265px;"><p:options bind="" collection="userPosts" value="postId" text="postName"/></select>
						</td>
						</tr>
						</table>
				</div>
			</div>
	  </div>
	</form>
</div>
<div class="ui-buttonBar">
	<a href="#" class="easyui-linkbutton" iconCls="icon_save" 
	onclick="useradmin_setrank();">保 存</a>
	<a href="#" class="easyui-linkbutton" iconCls="icon_cancel" onclick="$w.closeCurrWin()">取 消</a>
</div>